package com.example.administrator.webviewtest;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebSettings;

import com.github.lzyzsd.jsbridge.BridgeWebView;
import com.github.lzyzsd.jsbridge.DefaultHandler;

/**
 * Created by Administrator on 2016/3/7.
 */
public class PayFailActivity extends Activity {

    private BridgeWebView myWebView;
    private WebSettings webSettings;
    private String webviewUrl;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.payfail);
        myWebView = (BridgeWebView) findViewById(R.id.webview);
        webSettings = myWebView.getSettings();
        // 设置WebView属性，能够执行Javascript脚本
        webSettings.setJavaScriptEnabled(true);
        //设置此属性，可任意比例缩放
        webSettings.setUseWideViewPort(true);
        webSettings.setLoadWithOverviewMode(true);
        //设置字符编码
        webSettings.setDefaultTextEncodingName("UTF-8");
        // 设置Web视图
        // myWebView.setWebViewClient(new WebViewClient());
        //获取手势焦点
        myWebView.requestFocusFromTouch();
        //设置代理
        String ua = myWebView.getSettings().getUserAgentString();
        myWebView.getSettings().setUserAgentString(ua + "\nklyb100");
        myWebView.setDefaultHandler(new DefaultHandler());
        // 加载需要显示的网页
        myWebView.loadUrl(webviewUrl);
    }
}
